package com.yugao.fintech.antelope.infra.weixin.cp.handler;

import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.session.WxSessionManager;
import me.chanjar.weixin.cp.api.WxCpService;
import me.chanjar.weixin.cp.bean.message.WxCpXmlMessage;
import me.chanjar.weixin.cp.bean.message.WxCpXmlOutMessage;
import org.springframework.stereotype.Component;

import java.util.Map;


@Slf4j
@Component
public class WxCpScanHandler extends AbstractWxCpMessageHandler {

    @Override
    public WxCpXmlOutMessage handle(WxCpXmlMessage wxMessage, Map<String, Object> context,
                                    WxCpService wxCpService, WxSessionManager sessionManager) throws WxErrorException {
        try {
            String openId = wxMessage.getUserId();
            String eventKey = wxMessage.getEventKey();
            log.info("openId: {}, eventKey: {}", openId, eventKey);

//            AbstractWxScanEventProcessor.exec(wxMpXmlMessage, ScanScene.parse(eventKey));
//        throw new UnsupportedOperationException("未实现该处理，请自行重写");
        } catch (Exception e) {
            log.error("error: ", e);
        }
        return null;
    }
}
